﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Wpf_Examples
{
    /// <summary>
    /// WelcomeWindow.xaml 的交互逻辑
    /// </summary>
    public partial class WelcomeWindow : Window
    {
        private DispatcherTimer timer;
        public WelcomeWindow()
        {
            InitializeComponent();

            // 创建并启动计时器
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(3); // 设置延时时间（例如3秒）
            timer.Tick += Timer_Tick;
            timer.Start();
        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            if(myImage.Visibility== Visibility.Visible)
            {
                //跳转界面
                MainWindow mainWindow = new MainWindow();
                mainWindow.Show();
                // 停止计时器
                timer.Stop();
                //关闭当前界面
                this.Close();
            }
            else
            {
                // 设置图片可见
                myImage.Visibility = Visibility.Visible;
            }
        }
    }
}
